//
//  JsonTool.m
//  ZLShang
//
//  Created by wangguangming on 15/7/24.
//  Copyright © 2015年 Amber. All rights reserved.
//

#import "JsonTool.h"
@implementation NSURLRequest (NSURLRequestWithIgnoreSSL) 

+ (BOOL)allowsAnyHTTPSCertificateForHost:(NSString *)host 
{ 
    return YES; 
} 

@end

@implementation JsonTool
#pragma  mark 网络解析请求URL
+ (void)sloveDataFromUrlString:(NSString *)urlString dic:(NSMutableDictionary *)dic success:(SuccessBlocks)seccessBlock falleile:(FalleileBlock)falleile
{
        //请求URL
    NSURL *url = [NSURL URLWithString:urlString];
        //创建请求对象
    
    NSMutableURLRequest *request = [[NSMutableURLRequest alloc] initWithURL:url];
        //    [request setValue:vaule forHTTPHeaderField:fieldStr];
        //    [request setHTTPMethod:@"get"];
    
    
    
        //创建连接
    
    [NSURLConnection sendAsynchronousRequest:request queue:[NSOperationQueue mainQueue] completionHandler:^(NSURLResponse *response, NSData *data, NSError *connectionError) {
        if ([data length] > 0 && connectionError == nil) {
            seccessBlock(data);
        }else{
            falleile(connectionError);
        }
        
    }];
    
}

@end
